package com.api.shopapi.mapper;

import com.api.shopapi.entity.ESpecialtyHobby;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

@Repository
@Mapper
public interface ESpecialtyHobbyMapper {

    @Insert("insert into e_specialty_hobby (SpecialtyHobbyCode,UserCode,ElderlyCode,Specialty,Hobby) values " +
            "(#{specialtyHobby.SpecialtyHobbyCode},#{specialtyHobby.UserCode},#{specialtyHobby.ElderlyCode}," +
            "#{specialtyHobby.Specialty},#{specialtyHobby.Hobby})")
    int insert(@Param("specialtyHobby") ESpecialtyHobby specialtyHobby);

    @Delete("delete from e_specialty_hobby where SpecialtyHobbyCode=#{specialtyHobbyCode}")
    int delete(@Param("specialtyHobbyCode")String specialtyHobbyCode);

    @Select("select * from e_specialty_hobby where ElderlyCode=#{elderlyCode} limit 1")
    ESpecialtyHobby getByElderlyCode(@Param("elderlyCode")String elderlyCode);
}
